import request from '@/utils/request'

export function getTree(params?: any) {
  return request({
    url: '/menuManagement/getTree',
    method: 'get',
    params,
  })
}

export function doEdit(data: any) {
  return request({
    url: `/zgyp-system/api/v1/menus/${data.id}`,
    method: 'put',
    data,
  })
}
export function doAdd(data: any) {
  return request({
    url: `/zgyp-system/api/v1/menus`,
    method: 'post',
    data,
  })
}

export function details(params?: any) {
  return request({
    url: `/zgyp-system/api/v1/menus/${params}/form`,
    method: 'get',
    // params,
  })
}

export function getList() {
  return request({
    url: '/zgyp-system/api/v1/menus',
    method: 'get',
  })
}
export function doDelete(data: any) {
  return request({
    url: `/zgyp-system/api/v1/menus/${data.id}`,
    method: 'delete',
    data,
  })
}

/**
 * 菜单下拉列表
 */
export function fetchMenusList() {
  return request({
    url: '/zgyp-system/api/v1/menus/options',
    method: 'get',
  })
}
